import Vue from 'vue'
import VueRouter from 'vue-router'

import Login from '../page/Login.vue'
import Manage from '../page/Manage.vue'
import Home from '../page/Home.vue'
import Userlist from '../page/UserList.vue'
import ShopList from '../page/ShopList.vue'
import FoodList from '../page/FoodList.vue'
import OrderList from '../page/OrderList.vue'
import AdminList from '../page/AdminList.vue'
import AddShop from '../page/AddShop.vue'
import AddGoods from '../page/AddGoods.vue'
import Visitor from '../page/Visitor.vue'
import VueEdit from '../page/VueEdit.vue'
import AdminSet from '../page/AdminSet.vue'
import Explain from '../page/Explain.vue'

Vue.use(VueRouter)

const routes = [
  { path: '/', redirect: '/login' },
  { path: '/login', component: Login, meta: ['登录'] },
  {
    path: '/manage',
    component: Manage,
    redirect: '/home',
    children: [
      { path: '/home', component: Home },
      { path: '/userlist', component: Userlist, meta: ['数据管理', '用户列表'] },
      { path: '/shoplist', component: ShopList, meta: ['数据管理', '商家列表'] },
      { path: '/foodlist', component: FoodList, meta: ['数据管理', '食品列表'] },
      { path: '/orderlist', component: OrderList, meta: ['数据管理', '订单列表'] },
      { path: '/adminlist', component: AdminList, meta: ['数据管理', '管理员列表'] },
      { path: '/addshop', component: AddShop, meta: ['添加数据', '添加商铺'] },
      { path: '/addgoods', component: AddGoods, meta: ['添加数据', '添加商品'] },
      { path: '/visitor', component: Visitor, meta: ['图表', '用户发布'] },
      { path: '/vueedit', component: VueEdit, meta: ['编辑', '文本编辑'] },
      { path: '/adminset', component: AdminSet, meta: ['设置', '管理员设置'] },
      { path: '/explain', component: Explain, meta: ['说明', '说明'] }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
